/*!
重要的全局可定制性变量或参数或函数定义

 */

pub const PARALLEL_RECORD_KEY:&str = "record_server";
pub const PARALLEL_RECORD_IDX:&str = "record_idx";

pub const RECORD_CMD_ERROR: &str = "error";
pub const RECORD_CMD_NONE:  &str = "none";
pub const RECORD_CMD_DONE:  &str = "done";
pub const RECORD_CMD_CLEAR: &str = "clear";
pub const RECORD_CMD_OVERD: &str = "override";
pub const RECORD_CMD_APPED: &str = "append";

/**
根据文件扩展，判断是否允许被索引
 - 或许应该联动配置文件更好。
 - .docx, .xlsx, pptx 将被提取内容保存为.txt，所以自动视为txt类型，将被index, 不需要加入列表。
 */
pub fn index_file_is_allow(ext: &str) -> bool {
    let allow: Vec<&str> = vec!["txt", "py", "rs", "go","md"];
    if allow.contains(&ext) {
        true
    } else {
        false
    }
}

/**
根据文件扩展，判断是否允许被在线查看内容（preview）
 - 或许应该联动配置文件更好。
 */
pub fn is_preview_file(ext: &str) -> bool {
    let allow: Vec<&str> = vec!["txt", "md", "py", "rs", "go", "conf", "toml", "docx", "pptx", "xlsx", "record"];
    if allow.contains(&ext) {
        true
    } else {
        false
    }
}

/**
根据文件扩展，判断是否是图片文件
 - 或许应该联动配置文件更好。
 */
pub fn is_image_file(ext: &str) -> bool {
    let images: Vec<&str> = vec!["png", "jpg", "jpeg", "ico"];
    if images.contains(&ext) {
        true
    } else {
        false
    }
}
